package jnpf.engine.custom.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

@Configuration
public class ScriptEngineConfig {
    /**
     * 脚本引擎 JDK内置 但已经在JDK15之后弃用
     * @return
     */
    @Bean
    public ScriptEngine nashornEngine(){
        ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
        ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("js");
        return scriptEngine;
    }
}
